package com.wf.it.common.api;

import com.wf.it.common.api.hystrix.DeptServiceHystrixImpl;
import com.wf.it.common.entity.Dept;
import com.wf.it.common.vo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "hp-dept",fallback = DeptServiceHystrixImpl.class)
public interface DeptService {
    @GetMapping("/dept/findbynames")
    public Result<Map<String, Dept>> findByNames(@RequestParam("names") String[] names);

    @GetMapping("/dept/findbyname")
    public Result<Dept> findByName(@RequestParam("name")String name);

    @GetMapping("/dept/all")
    public Result<List<Dept>> findAll();

    @GetMapping("/dept/findbyid")
    public Result<Dept> findById(@RequestParam("id") int id);

    @PostMapping("/dept/add")
    public Result<Dept> add(@RequestBody Dept dept);
}
